perf: add RPC server instance cache to eliminate per-call HTTP agent … - #386
Merged
Jaydbrown merged 2 commits intoJul 30, 2026
Merged
Conversation
|
@OMGO-Code Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…creation All SDK functions that interact with the Soroban RPC were creating a new SorobanRpc.Server instance on every call, which meant a new HTTP agent (and TCP/TLS handshake) per operation. For operations like list() that issue N+1 calls, this added significant overhead. Changes: - Add getServer(rpcUrl) with a module-level Map cache in soroban.ts - Add clearServerCache() for test teardown and config changes - Refactor buildContractCallTx, invokeContract, simulateReadOnly to use cache - Refactor StreamsModule._server() to delegate to getServer() - Refactor events.ts subscribeToStream to use getServer() - Export getServer/clearServerCache from the public API - Add 10 unit tests covering cache hit, miss, clear, and integration - Document RPC Server Lifecycle in docs/api.md and docs/architecture.md Closes conduit-protocol#381
…onduit-protocol#392 createRpcServer() (the retry-with-backoff wrapper all SDK internals actually use to construct RPC servers) now gets its base SorobanRpc.Server from this PR's getServer() cache instead of always constructing a new one, so callers get both the caching and the automatic rate-limit retry together rather than having to choose one or the other. Also: - Remove an unused `getServer` import left over from the rebase in streams.ts (createRpcServer already covers it). - Fix the docs' "Internal usage" note, which said internal SDK code uses getServer() directly — it actually goes through createRpcServer(), which adds retry-with-backoff on top; getServer() alone gives the cached instance with no retry. - Drop an unused `xdr` import in the new soroban-server-cache.test.ts. Verified: full lint/typecheck/vitest clean (547 tests passing).
Jaydbrown
force-pushed
the
feat/381-detailed-sdk-feature
branch
from
July 30, 2026 06:18
2c2a03b to
f3c93d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…creation
All SDK functions that interact with the Soroban RPC were creating a new SorobanRpc.Server instance on every call, which meant a new HTTP agent (and TCP/TLS handshake) per operation. For operations like list() that issue N+1 calls, this added significant overhead.
Changes:
Closes #381
What does this PR do?
Type of change
Related issue
Closes #
Changes
Checklist
npm run typecheck— no errorsnpm run lint— no warningsnpm test— all tests passnpm run build— bundle compiles cleanlyanytypes introduceddocs/api.mdbigint— noNumber()conversion in arithmeticsrc/tests/CHANGELOG.mdupdated under[Unreleased]src/index.tsupdated if new exports addedBreaking changes?
BREAKING CHANGE:footer to relevant commitNotes for reviewers